home *** CD-ROM | disk | FTP | other *** search
/ NetObjects Fusion 7 / Fusion7.iso / NetObjects Fusion / data1.cab / Language_Resource_-_English / Components / AdBanner / UnrollTransition.class (.txt) < prev   
Encoding:
Java Class File  |  2002-10-18  |  2.4 KB  |  97 lines

  1. import java.awt.image.MemoryImageSource;
  2.  
  3. public class UnrollTransition extends BannerTransition {
  4.    static int[] fillPixels = new int[]{-1, -16777216, -16777216, -1};
  5.    int[] unrollAmount = null;
  6.    int location;
  7.  
  8.    public UnrollTransition() {
  9.       super.numOfFrames = 9;
  10.    }
  11.  
  12.    public void finishInit() {
  13.       float unrollIncrement = (float)super.imageHeight / (float)(super.numOfFrames + 1) / ((float)(super.numOfFrames + 2) / 2.0F);
  14.       int total = 0;
  15.       this.unrollAmount = new int[super.numOfFrames + 1];
  16.  
  17.       for(int u = 0; u <= super.numOfFrames; ++u) {
  18.          this.unrollAmount[u] = (int)(unrollIncrement * (float)(super.numOfFrames - u + 1));
  19.          total += this.unrollAmount[u];
  20.       }
  21.  
  22.       if (total < 0) {
  23.          int var10002 = this.unrollAmount[0]--;
  24.       }
  25.  
  26.       super.delay = 220;
  27.       this.location = super.pixelsPerImage;
  28.       System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, 0, super.workPixels, 0, super.pixelsPerImage);
  29.  
  30.       for(int f = 0; f < super.numOfFrames; ++f) {
  31.          this.location -= this.unrollAmount[f] * super.imageWidth;
  32.  
  33.          try {
  34.             Thread.sleep(150L);
  35.          } catch (InterruptedException var8) {
  36.          }
  37.  
  38.          this.Unroll(f);
  39.  
  40.          try {
  41.             Thread.sleep(100L);
  42.          } catch (InterruptedException var7) {
  43.          }
  44.  
  45.          super.frames[f] = super.owner.createImage(new MemoryImageSource(super.imageWidth, super.imageHeight, super.workPixels, 0, super.imageWidth));
  46.          super.owner.prepareImage(super.frames[f], super.owner);
  47.          System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, this.location, super.workPixels, this.location, this.unrollAmount[f] * super.imageWidth);
  48.       }
  49.  
  50.       super.workPixels = null;
  51.    }
  52.  
  53.    void Unroll(int f) {
  54.       int yFlip = super.imageWidth;
  55.       int[] offset = new int[this.unrollAmount[f]];
  56.  
  57.       for(int o = 0; o < this.unrollAmount[f]; ++o) {
  58.          offset[o] = 4;
  59.       }
  60.  
  61.       offset[0] = 2;
  62.       if (this.unrollAmount[f] > 1) {
  63.          offset[1] = 3;
  64.       }
  65.  
  66.       if (this.unrollAmount[f] > 2) {
  67.          offset[this.unrollAmount[f] - 1] = 2;
  68.       }
  69.  
  70.       if (this.unrollAmount[f] > 3) {
  71.          offset[this.unrollAmount[f] - 2] = 3;
  72.       }
  73.  
  74.       int offset_index = 0;
  75.  
  76.       for(int p = this.location; p < this.location + this.unrollAmount[f] * super.imageWidth; p += super.imageWidth) {
  77.          try {
  78.             System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, p - yFlip + offset[offset_index], super.workPixels, p, super.imageWidth - offset[offset_index]);
  79.             System.arraycopy(fillPixels, 0, super.workPixels, p + super.imageWidth - offset[offset_index], offset[offset_index]);
  80.             ++offset_index;
  81.             yFlip += super.imageWidth + super.imageWidth;
  82.          } catch (ArrayIndexOutOfBoundsException var8) {
  83.             break;
  84.          }
  85.       }
  86.  
  87.       for(int x = this.location + super.imageWidth - 1; x > this.location; --x) {
  88.          int[] var10000 = super.workPixels;
  89.          var10000[x] |= -5592406;
  90.          var10000 = super.workPixels;
  91.          int var10001 = x + this.unrollAmount[f];
  92.          var10000[var10001] &= -11184811;
  93.       }
  94.  
  95.    }
  96. }
  97.